package com.runjian.rundo.iot.agent.business.event;

import java.time.LocalDateTime;

import com.alibaba.fastjson2.annotation.JSONField;

import cn.hutool.core.lang.Assert;
import lombok.Getter;
import lombok.Setter;

/**
 * 设备事件
 *
 * @author CaoQingHua
 */
@Getter
@Setter
public abstract class DeviceEvent {

    /**
     * 设备id
     */
    private String deviceId;

    /**
     * 事件创建时间
     */
    @JSONField(serialize = false, deserialize = false)
    private LocalDateTime createTime;

    public DeviceEvent(String deviceId) {
        Assert.notEmpty(deviceId, "[发布设备事件] 创建事件响应设备id不能为空");
        this.deviceId = deviceId;
        this.createTime = LocalDateTime.now();
    }

}
